This forum is closed to new posts and
responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:
The point is that you do have to declare a variable that is to hold the reference to the NotesDocument object. But, unlike you are assuming, the declaration does not need to be local in the function that is called. It can just as well be in the calling script.
A simple example below demonstrates the difference.
Sub Initialize Const WELL_KNOWN_UNID$ = "8D0665FAED38C10DC1256DCB007AD8B4"'Replace with your own Dim doc As NotesDocument ' This will produce "Still there": Call Test(doc, WELL_KNOWN_UNID) ' This will produce "Gone with the wind!": Call Test(Nothing, WELL_KNOWN_UNID) EndSub
Sub Test(rDoc As NotesDocument, rUnid AsString) Dim s AsNew NotesSession() Set rDoc = s.CurrentDatabase.GetDocumentByUnid(rUnid) If rDoc IsNothingThen MsgBox"Gone with the wind!" Else MsgBox"Still there" EndIf EndSub
FWIW, it does not make any difference whether you access the document via GetDocumentByUnid() or by a lookup in a view. (Although there may be other reasons not to use GetDocumentByUnid(), as Willy argued.)
Feedback response number JSAK959T2S created by ~Chris Frofootherobu on 02/25/2013